<?php


namespace App\Utils;


class Result
{
    public static function success($data = []): \Illuminate\Http\JsonResponse
    {
        return response()->json([
            'code' => 200,
            'message' => 'ok',
            'data' => $data
        ]);
    }

    public static function error($code = 500, $msg = '系统出错了'): \Illuminate\Http\JsonResponse
    {
        return response()->json([
            'code' => $code,
            'message' => $msg
        ], 400);
    }
}
